package com.wetool.wechat.jpa;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.wetool.wechat.entity.MinaAccountRelation;
@Repository
public interface MinaAccountRelationRepo extends JpaRepository<MinaAccountRelation, String> {

//	@Query("select o from MinaAccountRelation o where o.minaOpenid = ?1")
    MinaAccountRelation findByMinaOpenid(String minaOpenid);

//	@Query("select o from MinaAccountRelation o where o.thirdSession = ?1")
	MinaAccountRelation findByThirdSession(String thirdSession);

	@Modifying
	@Query(value="update MinaAccountRelation o set o.thirdSession = null where o.thirdSession =?1 ")
	void updateThirdSession(String thirdSession);
}
